import AjaxSend from '@/pages/search/ajax/http';
import { type } from 'os';
/**
 * @Template 服务模板示例
 * interface:{  定义请求的名称，请保持唯一
 *  method: string, 请求方式（get、delete、head、post、put、patch）
 *  requestUrl: string, 请求的服务地址（在接口地址中'不'包含参数下使用，例如：'api/v1/user/'）
 *  requestCommon: function, 请求的服务地址（在接口地址中包含参数下使用，例如：'api/v1/users/' + params + '/active'）
 *  requestPost: function  返回对象类型，可以自己定义。（主要用于post请求也需要在url上面传参的方式；例如：'api/v1/user?id=param'，同时也有在body传参）
 * }
 */
let PublicObjService = {
  getHotWord: {
    requestUrl: '/search/search/hotWord/get',
    method: 'get'
  },
  getTips:{
    requestUrl: '/search/search/tip/getTips',
    method: 'get'
  },
  searchAllItems:{
    requestUrl: '/search/search/meta/items',
    method: 'get'
  },
  searchQueryKey:{
    requestUrl: '/search/search/data/micro/-1/queryKey',
    method: 'post'
  },
  searchQueryKeyGet:{
    requestUrl: '/search/search/data/macro/-1/queryKey',
    method: 'get'
  },
  updateKey:{
    requestUrl: '/search/search/hotWord/update',
    method: 'put'
  },
  macroRecportType:{
    requestUrl: '/search/search/data/get/macro/reportType',
    method: 'get'
  },
  microRecportType:{
    requestUrl: '/search/search/data/get/micro/reportType',
    method: 'get'
  },
  microSearchTree:{
    requestUrl: '/search/search/data/get/micro/advanceSearch',
    method: 'get'
  },
  microGroupVersion:{
    requestUrl: '/micro/micro_group_version/select',
    method: 'get'
  },
  microEnum:{
    requestUrl: '/micro/micro_enum/select/parent_code',
    method: 'get'
  },
  microIdentValue:{
    requestUrl: '/mianalysis/micro/base/select/root/ident/value',
    method: 'get'
  }
};

AjaxSend.loopServiceApi(PublicObjService);
export function getHotWord(params) {
  return PublicObjService.getHotWord.send(params);
}
export function getTips(params) {
  return PublicObjService.getTips.send(params);
}
export function searchAllItems(params) {
  return PublicObjService.searchAllItems.send(params);
}
export function searchQueryKey(params,mitmid) {
  PublicObjService.searchQueryKey.requestUrl = `/search/search/data/micro/${mitmid}/queryKey`;
  return PublicObjService.searchQueryKey.send(params);
}
export function searchQueryKeyGet(params,mitmid,type) {
  PublicObjService.searchQueryKeyGet.requestUrl = `/search/search/data/${type}/${mitmid}/queryKey`;
  return PublicObjService.searchQueryKeyGet.send(params);
}
export function updateKey(params) {
  return PublicObjService.updateKey.send(params);
}
export function macroRecportType(params) {
  return PublicObjService.macroRecportType.send(params);
}
export function microRecportType(params) {
  return PublicObjService.microRecportType.send(params);
}
export function microSearchTree(params) {
  return PublicObjService.microSearchTree.send(params);
}
export function microGroupVersion(params,gid) {
  PublicObjService.microGroupVersion.requestUrl = `/micro/micro_group_version/select/${gid}`;
  return PublicObjService.microGroupVersion.send(params);
}
export function microEnum(params) {
  return PublicObjService.microEnum.send(params);
}
export function microIdentValue(params) {
  return PublicObjService.microIdentValue.send(params);
}


